package neural;

import java.util.List;

public class Individual {

	List<Double> weights;
	double fitness;
	
	public Individual() {
		weights = Net.getInstance().newNet();
		calcFitness();
	}
	
	public Individual(List<Double> weights) {
		this.weights = weights;
		calcFitness();
	}
	
	private void calcFitness(){
		fitness = 1/Net.getInstance().error(weights);
	}
	
	public double getFitness() {
		return fitness;
	}
	
	public List<Double> getWeights() {
		return weights;
	}
	
	public void setWeights(List<Double> weights) {
		this.weights = weights;
		calcFitness();
	}
}
